﻿//********************************************************************************//
//创建日期：<创建日期，2017-6-11>
//创建作者：<郭登杰，guodengjie@shanghai3h.com>
//功能说明：地下水欠费信息合计Model
//********************************************************************************//
using System;
using System.Collections.Generic;
using YXYLCommon;
using System.Data;

namespace Entity
{
    [Serializable]
    /// <summary>
    /// 地下水欠费信息(目前地下水,地表水,自来水共用)
    /// </summary>
    public class DXSQianFeiXX : BaseModel
    {
        public DXSQianFeiXX()
        {
          
        }

        public string S_ZHANGDANBH { get; set; }
        public string S_YONGHUH { get; set; }

        public string S_YONGHUM { get; set; }

        public int I_YM { get; set; }

        public decimal N_YINGSHOUJE { get; set; }

        public decimal N_SHISHOUJE { get; set; }

        public decimal N_QIANFEIJE { get; set; }


        public override BaseModel ToObject(System.Data.DataRow row)
        {
            this.IsExists = (Convert.ToString(row["S_YONGHUH"])!="-1");
            this.S_ZHANGDANBH = row.Table.Columns.Contains("S_ZHANGDANBH")?Convert.ToString(row["S_ZHANGDANBH"]):"-1";
            this.S_YONGHUH = Convert.ToString(row["S_YONGHUH"]);
            this.S_YONGHUM = Convert.ToString(row["S_YONGHUM"]);
            this.N_YINGSHOUJE = Convert.ToDecimal(row["N_YINGSHOUJE"]);
            this.N_SHISHOUJE = Convert.ToDecimal(row["N_SHISHOUJE"]);
            this.I_YM = row.Table.Columns.Contains("I_YM")?Convert.ToInt32(row["I_YM"]):-1;
            this.N_QIANFEIJE = row.Table.Columns.Contains("N_QIANFEIJE")?Convert.ToDecimal(row["N_QIANFEIJE"]):-1;
            return this;
        }
    }
    /// <summary>
    /// 地下水收费信息(目前地下水,地表水,自来水共用)
    /// </summary>
    public class DXSShouFeiXX : BaseModel
    {
        public DXSShouFeiXX()
        {

        }

        public string S_ZHANGDANBH { get; set; }
        public string S_YONGHUH { get; set; }

        public string S_YONGHUM { get; set; }

        public int I_YM { get; set; }

        public int I_ZWYM { get; set; }

        public string S_SHOUFEIRQ { get; set; }

        public decimal N_SHOUFEIJE { get; set; }

        public string S_SHOUFEIFS { get; set; }

        public DbDateTime D_SHOUFEIRQ { get; set; }

        public int ID { get; set; }

        public override BaseModel ToObject(System.Data.DataRow row)
        {
            //this.IsExists = (Convert.ToString(row["S_YONGHUH"]) != "-1");
            this.ID = row.Table.Columns.Contains("ID") ? Convert.ToInt32(row["ID"]) : -1;
            this.S_ZHANGDANBH = row.Table.Columns.Contains("S_ZHANGDANBH") ? Convert.ToString(row["S_ZHANGDANBH"]) : "-1";
            this.S_YONGHUH = Convert.ToString(row["S_YONGHUH"]);
            this.S_YONGHUM = Convert.ToString(row["S_YONGHUM"]);
            this.N_SHOUFEIJE = Convert.ToDecimal(row["N_SHOUFEIJE"]);
            this.S_SHOUFEIFS = Convert.ToString(row["S_SHOUFEIFS"]);
            this.I_YM = row.Table.Columns.Contains("I_YM") ? Convert.ToInt32(row["I_YM"]) : -1;
            this.S_SHOUFEIRQ = Convert.ToString(row["S_SHOUFEIRQ"]);
            this.I_ZWYM = row.Table.Columns.Contains("I_ZWYM") ? Convert.ToInt32(row["I_ZWYM"]) : -1;
            this.D_SHOUFEIRQ = row.Table.Columns.Contains("D_SHOUFEIRQ") ? DbDateTime.Parse(row["D_SHOUFEIRQ"]) : DbDateTime.Parse(null);
            return this;
        }
    }
    public class DALDXSQFSFXX : BaseDAL
    {
        public DALDXSQFSFXX()
        {

        }
        protected override void fillSaveProc(BaseModel model)
        {
            
        }

        /// <summary>
        /// 获取欠费合计
        /// </summary>
        /// <param name="yhh"></param>
        /// <returns></returns>
        public DXSQianFeiXX GetQFHJ(string yhh)
        {
            dbProc.Init("P_DXSSF_QIANFEIXXHJ");
            dbProc.AddParameter("V_YONGHUH", yhh);
            return CommonService.Ini().GetObject<DXSQianFeiXX>(dbProc);
        }
        /// <summary>
        /// 获取欠费明细
        /// </summary>
        /// <param name="yhh"></param>
        /// <returns></returns>
        public List<DXSQianFeiXX> GetQFMX(string yhh)
        {
            dbProc.Init("P_DXSSF_QIANFEIXXMX");
            dbProc.AddParameter("V_YONGHUH", yhh);
            return CommonService.Ini().GetList<DXSQianFeiXX>(dbProc);
        }

        /// <summary>
        /// 单笔收费
        /// </summary>
        /// <param name="zdbh">账单编号</param>
        /// <param name="je">收费金额</param>
        /// <param name="zwym">收费账务年月</param>
        public DbCmdResult DBSF(string zdbh,decimal je,int zwym,int type,string czr)
        {
            dbProc.Init("P_DXS_DANBISF");
            dbProc.AddParameter("V_ZHANGDANBH", zdbh);
            dbProc.AddParameter("V_SHOUFEIJE", je);
            dbProc.AddParameter("V_ZWYM", zwym);
            dbProc.AddParameter("V_TYPE", type);
            dbProc.AddParameter("V_CAOZUOR", czr);
            return CommonService.Ini().ExcuteProcOracle(dbProc);
        }

        /// <summary>
        /// 获取收费明细
        /// </summary>
        /// <param name="yhh"></param>
        /// <returns></returns>
        public List<DXSShouFeiXX> GetSFMX(int zwym,DateTime? sfrq,string yhh)
        {
            dbProc.Init("P_DXSSF_SHOUFEIXXMX");
            dbProc.AddParameter("V_ZWYM", zwym);
            dbProc.AddParameter("V_SHOUFEIRQ", sfrq);
            dbProc.AddParameter("V_YONGHUH", yhh);
            return CommonService.Ini().GetList<DXSShouFeiXX>(dbProc);
        }

        /// <summary>
        /// 收费取消
        /// </summary>
        /// <param name="zdbhs"></param>
        /// <returns></returns>
        public DbCmdResult SFQX(string ids,string zdbhs,string caozuor)
        {
            dbProc.Init("P_DXSSF_SHOUFEIQX");
            dbProc.AddParameter("V_IDS", ids);
            dbProc.AddParameter("V_ZHANGDANBHS", zdbhs);
            dbProc.AddParameter("V_CAOZUOR", caozuor);
            return CommonService.Ini().ExcuteProc(dbProc);
        }
    }
    /// <summary>
    /// 自来水欠收费信息DLL
    /// </summary>
    public class DALYSQFSFXX : BaseDAL
    {
        public DALYSQFSFXX()
        {

        }
        protected override void fillSaveProc(BaseModel model)
        {

        }

        /// <summary>
        /// 获取欠费合计
        /// </summary>
        /// <param name="yhh"></param>
        /// <returns></returns>
        public DXSQianFeiXX GetQFHJ(string yhh)
        {
            dbProc.Init("P_YSSF_QIANFEIXXHJ");
            dbProc.AddParameter("V_YONGHUH", yhh);
            return CommonService.Ini().GetObject<DXSQianFeiXX>(dbProc);
        }
        /// <summary>
        /// 获取欠费明细
        /// </summary>
        /// <param name="yhh"></param>
        /// <returns></returns>
        public List<DXSQianFeiXX> GetQFMX(string yhh)
        {
            dbProc.Init("P_YSSF_QIANFEIXXMX");
            dbProc.AddParameter("V_YONGHUH", yhh);
            return CommonService.Ini().GetList<DXSQianFeiXX>(dbProc);
        }
        /// <summary>
        /// 单笔收费
        /// </summary>
        /// <param name="zdbh">账单编号</param>
        /// <param name="je">收费金额</param>
        /// <param name="zwym">收费账务年月</param>
        public DbCmdResult DBSF(string sfbh,string zdbh, decimal je, int zwym, int type, string czr)
        {
            dbProc.Init("P_YSSF_DANBISHOUFEI");
            dbProc.AddParameter("V_SHOUFEIBH", sfbh);
            dbProc.AddParameter("V_FEIYONGBH", zdbh);
            dbProc.AddParameter("V_MONEY", je);
            dbProc.AddParameter("V_CAOZUOR", czr);
            dbProc.AddParameter("V_TUOSHOUPZH", 0);
            dbProc.AddParameter("V_TYPE", type);
            dbProc.AddParameter("V_ZWYM", zwym);
            return CommonService.Ini().ExcuteProcOracle(dbProc);
        }


        public string GetDANGQIANSFBH()
        {
            dbProc.Init("P_YSSF_SHOUFEIBHHQ");
            return CommonService.Ini().GetSingleResult(dbProc);
        }
        /// <summary>
        /// 获取收费明细
        /// </summary>
        /// <param name="yhh"></param>
        /// <returns></returns>
        public List<DXSShouFeiXX> GetSFMX(int zwym, DateTime? sfrq, string yhh)
        {
            dbProc.Init("P_YSSF_SHOUFEIXXMX");
            dbProc.AddParameter("V_ZWYM", zwym);
            dbProc.AddParameter("V_SHOUFEIRQ", sfrq);
            dbProc.AddParameter("V_YONGHUH", yhh);
            return CommonService.Ini().GetList<DXSShouFeiXX>(dbProc);
        }
        /// <summary>
        /// 收费取消
        /// </summary>
        /// <param name="zdbhs"></param>
        /// <returns></returns>
        public DbCmdResult SFQX(string ids, string zdbhs, string caozuor)
        {
            dbProc.Init("P_YSSF_SHOUFEIQX");
            dbProc.AddParameter("V_IDS", ids);
            dbProc.AddParameter("V_ZHANGDANBHS", zdbhs);
            dbProc.AddParameter("V_CAOZUOR", caozuor);
            return CommonService.Ini().ExcuteProc(dbProc);
        }
        /*

       

        

        

        
        */
    }

}